<%
translation_cache = {} if !defined?(translation_cache) || translation_cache.nil?
show_author_details = defined?(show_author_details) && show_author_details
show_report_thread = defined?(show_report_thread) && show_report_thread
%>
<li data-script-id="<%=script.id%>" data-script-name="<%=script.name(I18n.locale)%>" data-script-author-id="<%=script.user.id%>" data-script-author-name="<%=script.user.name%>" data-script-daily-installs="<%=script.daily_installs%>" data-script-total-installs="<%=script.total_installs%>" data-script-rating-score="<%=script.fan_score%>" data-script-created-date="<%=script.created_at.strftime('%Y-%m-%d')%>" data-script-updated-date="<%=script.code_updated_at.strftime('%Y-%m-%d')%>" data-script-type="<%=script.script_type.short_name%>" data-script-version="<%=script.version%>" data-sensitive="<%=script.sensitive%>">
	<article>
		<h2>
			<%=link_to script.name(I18n.locale), script_path(script)%>
			<% if show_author_details && script.user == current_user && script.sensitive %>
				<span class="script-type"><%=translation_cache['scripts.adult_marker'] || t('scripts.adult_marker')%></span>
			<% end %>
			<% case script.script_type_id
				when 2 %>
					<span class="script-type"><%=translation_cache['scripts.unlisted_marker'] || t('scripts.unlisted_marker')%></span>
				<% when 3 %>
					<span class="script-type"><%=translation_cache['scripts.library_marker'] || t('scripts.library_marker')%></span>
			<% end %>
			<% if script.deleted? %>
				<span class="script-type"><%=translation_cache['scripts.deleted_marker'] || t('scripts.deleted_marker')%></span>
			<% end %>
			<% if script.locked %>
				<span class="script-type"><%=translation_cache['scripts.locked_marker'] || t('scripts.locked_marker')%></span>
			<% end %>
			<span class="name-description-separator">
				-
			</span>
			<span class="description">
				<%=script.description(I18n.locale)%>
			</span>
		</h2>
		<dl>
			<dt class="script-list-author"><span><%=translation_cache['scripts.author_name'] || t('scripts.author_name')%></span></dt>
			<dd class="script-list-author"><span><%=link_to script.user.name, user_path(script.user)%></span></dd>
			<dt class="script-list-daily-installs"><span><%=translation_cache['scripts.daily_installs'] || t('scripts.daily_installs')%></span></dt>
			<dd class="script-list-daily-installs"><span><%=number_with_delimiter(script.daily_installs)%></span></dd>
			<dt class="script-list-total-installs"><span><%=translation_cache['scripts.total_installs'] || t('scripts.total_installs')%></span></dt>
			<dd class="script-list-total-installs"><span><%=number_with_delimiter(script.total_installs)%></span></dd>
			<dt class="script-list-ratings"><span><%=translation_cache['scripts.ratings'] || t('scripts.ratings')%></span></dt>
			<dd class="script-list-ratings" data-rating-score="<%=script.fan_score%>"><span><%=render :partial => 'scripts/ratings', :locals => {:script => script}%></span></dd>
			<dt class="script-list-created-date"><span><%=translation_cache['scripts.created_date'] || t('scripts.created_date')%></span></dt>
			<dd class="script-list-created-date"><span><%=markup_date(script.created_at)%></span></dd>
			<dt class="script-list-updated-date"><span><%=translation_cache['scripts.updated_date'] || t('scripts.updated_date')%></span></dt>
			<dd class="script-list-updated-date"><span><%=markup_date(script.code_updated_at)%></span></dd>
		</dl>
		<% if show_report_thread %>
			Report threads:
			<ul>
				<% script.discussions.reports.each do |discussion| %>
					<li><%= link_to(discussion.unescaped_name, discussion.url) %> by <%=link_to(discussion.original_poster.name, discussion.original_poster) %></li>
				<% end %>
			</ul>
		<% end %>
	</article>
</li>
